<template>
  <div class="row">
    <div class="col-4 mb-4" v-for="column in list" :key="column.id">
      <div class="card h-100 shadow-sm">
        <div class="card-body text-center">
          <img class="rounded-circle border border-light my-3" :src="column.avatar" :alt="column.title" />
          <h5 class="card-title">{{ column.title }}</h5>
          <p class="card-text text-left">{{ column.description }}</p>
          <router-link class="btn btn-outline-primary" :to="`/column/${column.id}`">进入专栏</router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType } from "vue";
import { ColumnProps } from "../types";

export default defineComponent({
  name: "Columns",
  props: {
    list: {
      type: Array as PropType<ColumnProps[]>,
      required: true
    },
  },
});
</script>

<style scoped>
.card-body img {
  width: 50px;
  height: 50px;
}
</style>